package com.example.demo.dao;

import com.example.demo.pojo.ClassificationTable;
import com.example.demo.pojo.CommodityList;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface CommodityListDao {
    int deleteByPrimaryKey(Integer goodsid);

    int insert(CommodityList record);

    int insertSelective(CommodityList record);

    CommodityList selectByPrimaryKey(Integer goodsid);


    int updateByPrimaryKeySelective(CommodityList record);


    int updateByPrimaryKey(CommodityList record);

    @Select("select goodsid from commodity_list where skucode=#{sku}")
     int findIdbySkucode(String sku);


    @Select("SELECT * FROM commodity_list WHERE commodity_list.goodsId in (#{a}) AND commodity_list.tradeName LIKE CONCAT('%',#{tradeName},'%') ")
    List<CommodityList> selectByreper(String a, String tradeName);

    @Select("select * from commodity_list where goodsId IN (SELECT goodsId FROM repertorygoods WHERE repertorygoods.repertoryId=#{cangku}) AND classificationId=#{classificationid}")
    List<CommodityList> findGoodsByClassificationid(ClassificationTable classificationTable);


    @Select("select * from commodity_list ")
    List<CommodityList> findAllCommoditylist();

    //查询单个商品信息
    @Select("select * from commodity_list where goodsid=#{id}")
    CommodityList findGoodsMessageByGoodsid(int id);

}
